package com.itheima.sky.dao;

import com.itheima.sky.dto.SetmealSaveDTO;
import com.itheima.sky.pojo.Setmeal;
import com.itheima.sky.pojo.SetmealDish;
import com.itheima.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealMapper {


    //根据类别的id查找套餐总数
    @Select("select count(*) from setmeal where category_id=#{id}")
    long findSetMealByCategoryId(Long id);

    List<SetmealVO> findSetmalList(String name);

    /**
     * 新增套餐
     * @param setmealSaveDTO
     */

    //@Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void save(SetmealSaveDTO setmealSaveDTO);

    /**
     * 删除
     * @param ids
     * @return
     */
    Long queryDishWithStatus(List<Long> ids);

    /**
     *
     * @param ids
     */
    void deleteByIds(List<Long> ids);

    /**
     * 批量起售成功
     * @param ids
     */
    void updatestatus1(List<Long> ids);

    /**
     * 批量停售成功
     * @param ids
     */
    void updatestatus0(List<Long> ids);

    /**
     *
     * @param setmealSaveDTO
     */
    void updateById(SetmealSaveDTO setmealSaveDTO);

    void deleteByDishId(Long id);

    /**
     * 获取修改前的数据
     */
    @Select("select * from setmeal where id = #{id}")
    Setmeal findBeforeById(Long id);

    List<SetmealDish> selectSetmealDishById(Long id);
}
